const { v4: uuidv4 } = require('uuid');

function generateUserId() {
    // 生成一个UUID
    const uuid = uuidv4();
    // 去掉UUID中的短横线，并取前9个字符作为ID
    const shortId = uuid.replace(/-/g, '').substring(0, 12);
    return shortId;
}

function generateArticleId() {
    const uuid = uuidv4();
    const articleId = 'Art' + uuid.replace(/-/g, '').substring(0, 12)
    return articleId
}

function generateColumnId() {
    const uuid = uuidv4();
    const ColumnId = 'Col' + uuid.replace(/-/g, '').substring(0, 8)
    return ColumnId
}

module.exports = {
    generateUserId,
    generateArticleId,
    generateColumnId
}